#!/usr/bin/perl
use strict;
use Tie::File::AsHash;

my %C = (
    interval => 10, # in minutes
    state_file => '/var/tmp/synchronizer.state'
);

# XXX: tied hash doesn't know anything about external updates.
# It makes read one time on first get operation.
# It makes flush on each store operation.
# It doesn't check about duplicate entries and shows first entry
# but duplicates returned with keys, values, each (see doc).
tie my %state, 'Tie::File::AsHash', $C{state_file}, split => ':'
    or die $C{state_file} . ": $!";

<>;
print $state{id}, "\n";
<>;
print $state{id}, "\n";

$state{id} = 'abc';


$state{id2} = 'def';
<>;

untie %state;